package edu.scu.declaresys.service.intr;

import edu.scu.declaresys.exception.ExecuteException;
import edu.scu.declaresys.util.PageList;
import edu.scu.declaresys.vo.User;

/**
 * 
 * @author: zt
 * @since : 2013-7-5
 */
public interface IUserService
{
	//
	// write methods.
	//
	public User add(User vo) throws ExecuteException;
	
	public void updateBasicInfo(User vo, Integer id) throws ExecuteException;
	
	public void delete(Integer id) throws ExecuteException;
	
	//
	// read methods.
	//
	public User findById(Integer id, Integer depth) throws ExecuteException;
	
	public User findUniqueByName(String userName) throws ExecuteException;
	
	public PageList<User> findUserList(Integer areaCityId, Integer areaCountyId, String userName, Integer role, Integer pageNum) throws ExecuteException;
	
	public PageList<User> findUserListInArea(Integer areaId, Integer pageNum) throws ExecuteException;

	
	/**
	 * 检查是否有用户在该地区下面
	 *@param areaId
	 *@return
	 *@throws ExecuteException
	 */
	public boolean hasUserInArea(Integer areaId) throws ExecuteException;

	//
	// utility
	//
	public boolean isPswdMatch(Integer userId, String pswd) throws ExecuteException;

	public boolean isPswdValid(String pswd);

	void updatePswd(Integer userId, String pswd) throws ExecuteException;

}
